from django.db import models
from django.contrib.auth.models import User

class User(models.Model):
    username=models.CharField(max_length=30,unique=True)
    password=models.CharField(max_length=100) #加密密码不建议设置过短
    age=models.IntegerField(default=18)

class UserProfile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    age = models.IntegerField()
    # 可以添加其他字段，如 address, phone 等

    def __str__(self):
        return self.user.username

